package com.bird.controller.superadmin;

import com.bird.domain.dto.Result;
import com.bird.domain.entity.HeadLine;
import com.bird.server.solo.HeadLineService;
import org.simpleFramework.core.annotation.Controller;
import org.simpleFramework.core.inject.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @Author: sijunqiang
 * @Date: 2020/3/29 20:20
 * @Description:
 */
@Controller
public class HeadLineOperationController {

    @Autowired
    private HeadLineService headLineService;


    /**
     * 添加头条信息
     *
     * @param request
     * @param response
     */
    //todo 参数校验以及请求参数的校验
    public Result<Boolean> addHeadLine( HttpServletRequest request, HttpServletResponse response) {
        return headLineService.addHeadLine(new HeadLine());
    }

    /**
     * 移除头条信息
     *
     * @param headLineId
     * @return
     */
    //todo 参数校验以及请求参数的校验
    public Result<Boolean> removeHeadLine(int headLineId) {
        return headLineService.removeHeadLine(1);
    }


    /**
     * 修改头条信息
     *
     * @param headLine
     * @return
     */
    //todo 参数校验以及请求参数的校验
    public Result<Boolean> modifyHeadLine(HeadLine headLine) {
        return headLineService.modifyHeadLine(new HeadLine());
    }

    /**
     * 根据id 查询头条信息
     *
     * @param headLineId
     * @return
     */
    //todo 参数校验以及请求参数的校验
    public Result<HeadLine> queryHeadLine(int headLineId) {
        return headLineService.queryHeadLine(1);
    }

    /**
     * 查询头条列表并分页
     *
     * @param headLineCondition
     * @param pageIndex
     * @param pageSize
     * @return
     */
    //todo 参数校验以及请求参数的校验
    public Result<List<HeadLine>> queryHeadLine(HeadLine headLineCondition, int pageIndex, int pageSize) {
        return headLineService.queryHeadLine(null, 1, 100);
    }
}
